@extends('statistical.layout')
@push('css')
    <link rel="stylesheet" href="{{ asset('admin-assets/plugins/datepicker/datepicker3.css') }}"/>
@endpush
@section("content")
    <div class="alert alert-info" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
        简单说明：
        <p>1. 只需上传 <strong>选择日期当天</strong> 的数据信息(成功充值、未充值、充值用户数据)</p>
        <p>2. 上传的数据必须是 <strong>选择日期当天的全量数据</strong>(例如：8点时候，充值数为100, 到了10点的时候，充值数为200，到了23：59的时候，充值数为500，那么上传的充值数值应该为
            500)</p>
        <p>3. 选择日期当天<strong>多次上传</strong>的话，<strong>以最后一次为准<strong></p>
    </div>
    @if (session()->has('success'))
        <div class="alert alert-success" role="alert">
            {{ session('success') }}
        </div>
    @elseif (session()->has('error') || (isset($errors) && $errors->all()))
        <div class="alert alert-danger" role="alert">
            {{ session('error') }}
            @if(isset($errors) && $errors->all())
                {{ $errors->first('file') }}
            @endif
        </div>
    @endif
    <form method="POST" action="{{ url('statistical/user/upload-data') }}" enctype="multipart/form-data">
        {{ csrf_field() }}
        <div class="form-group">
            <label for="file">日期</label>
            <input type="text"
                   class="form-control date-time"
                   name="create_date"
                   value="{{ date('Y-m-d') }}"
            ></div>
        <div class="form-group">
            <label for="file">上传Excel文件</label>
            <input type="file" id="file" name="file">
            <p class="help-block">
                <a href="/template.xlsx">模板文件下载</a>
            </p>
        </div>
        <button type="submit" class="btn btn-primary">上传</button>
    </form>
@endsection
@push('javascript')
    <script src="{{ asset('admin-assets/plugins/datepicker/moment.min.js') }}"></script>
    <script src="{{ asset('admin-assets/plugins/datepicker/bootstrap-datepicker.js') }}"></script>
    <script src="{{ asset('admin-assets/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js') }}"></script>
    <script>
        $("input.date-time").datepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            todayBtn: 'linked',
        })
    </script>
@endpush
